<?php

namespace LowCode\Naive;


use LowCode\Naive;
use LowCode\Node;
use LowCode\Support\JsExp;

/**
 * 组件 NSteps
 * @method static static make(mixed $children = null) NSteps组件
 */
class Steps extends Naive
{
    /**
     * @param mixed|null $children
     */
    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * @param int|JsExp $current
     * @return $this
     */
    public function current(int|JsExp $current = 0): static
    {
       return $this->prop("current",$current);
    }

    /**
     * @param string $value
     * @param string|null $id
     * @param array $options
     * @return $this
     */
    public function vModelCurrent(string $value = "", string $id = null, array $options = []): static
    {
        return $this->vModelArg("current", $value, $id, $options);
    }


    /**
     * @param string|JsExp $size
     * @return $this
     */
    public function size(string|JsExp $size = 'small' | 'medium'): static
    {
        return $this->prop("size",$size);
    }

    /**
     * @param string|JsExp $status
     * @return $this
     */
    public function status(string|JsExp $status = 'process' | 'finish' | 'error' | 'wait'): static
    {
        return $this->prop("status",$status);
    }

    /**
     * @param bool|JsExp $bool
     * @return $this
     */
    public function vertical(bool|JsExp $bool = true): static
    {
        return $this->prop("vertical",$bool);
    }

    /**
     * @param string $event (index: number) => void
     * @param string|null $id
     * @param array $modifiers
     * @return $this
     */
    public function onUpdateCurrent(string $event = "()=>{  }", string $id = null, array $modifiers = []): static
    {
        return $this->event("update:current", jsFn($event, $id), $modifiers);
    }

    /**
     * 设置 finish-icon 'finish' 状态按钮配置
     * @param Node $node
     * @return $this
     */
    public function slotFinishIcon(Node $node): static
    {
        return $this->addSlot($node,'finish-icon');
    }

    /**
     * 设置 error-icon 'error' 状态按钮配置
     * @param Node $node
     * @return $this
     */
    public function slotErrorIcon(Node $node): static
    {
        return $this->addSlot($node,'error-icon');
    }
}
